import 'dart:ui';

import 'package:flutter/material.dart';
import 'res/listData.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text("有点f麻烦"),
        ),
        body: HomePage(),
      ),
    );
  }
}

// 自定有状态组件
class HomePage extends StatefulWidget {
  HomePage({Key key}) : super(key: key);

  @override
  _HomePageState createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  List mList = new List();
  int num = 0;
  @override
  Widget build(BuildContext context) {
    return ListView(
      children: <Widget>[
        Column(
            children: this.mList.map((value) {
          return ListTile(
            title: Text(value),
          );
        }).toList()),
        SizedBox(height: 10),
        RaisedButton(
          child: Text("按钮"),
          onPressed: () {
            setState(() {
              this.mList.add("新增1");
            });
          },
        )
      ],
    );
  }
}
